module.exports = {
  namespaced: true,
  state: {
    token:uni.getStorageSync('user-token')||'',
    info: uni.getStorageSync('user-info')||{},
    clocks:uni.getStorageSync('user-clocks')||[] // 打卡数据
  },
  getters: {
    info: state => state.info,
    token: state => state.token,
    clocks:state => state.clocks
  },
  mutations: {
    updateInfo(state, data) {
      uni.setStorageSync('user-info',data);
      state.info = data || {};
    },
    updateClocks(state, data) {
      uni.setStorageSync('user-clocks',data);
      state.clocks = data || [];
    },
    updateToken(state, data) {
      uni.setStorageSync('user-token',data);
      state.token = data || {};
    },
  }
}
